package com.liu.stockmarket.mpchart


import com.github.mikephil.charting.data.BarDataSet
import com.github.mikephil.charting.data.BarEntry

/**
 * 自定义颜色
 */
class QuotationDataSet(yVals: List<BarEntry>, label: String) : BarDataSet(yVals, label) {

    override fun getColor(index: Int): Int {

        if (colors.size < 2) {
            colors[0]
        }
        val entry = getEntryForIndex(index)

        return if (entry.y > 0) {
            colors[0]
        }else{
            colors[1]
        }

    }
    override fun getEntryIndex(e: BarEntry): Int {
        return super.getEntryIndex(e)
    }

}